<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    img {
        position: absolute;
        top: 2px;
    }
</style>

<body>
    <img src="img/angle.gif" alt="">
    <script>

        /*
            需求:
                1. 移动鼠标，获取鼠标的坐标
                2. 图片跟随移动，把鼠标的坐标给图片
*/

        var img = document.querySelector('img');

        document.addEventListener('mousemove', function(e) {
            /* console.log(this);
            console.log(e.clientX, e.clientY); */ // clientY : 鼠标在可视区的y坐标
            img.style.left = e.clientX - 100 + 'px';
            img.style.top = e.clientY - 70 + 'px';
        })
    </script>
</body>

</html>